﻿<Window x:Class="SnowmanConsulting.ProductKeyManager.UI.ProductDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ui="clr-namespace:SnowmanConsulting.ProductKeyManager.UI"
    Style="{DynamicResource ProductDialog}"
    Title="New Product" Loaded="WindowLoaded" WindowStartupLocation="CenterOwner">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/ProductDialogResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <DockPanel>
        <DockPanel LastChildFill="True" DockPanel.Dock="Top">
            <DockPanel DockPanel.Dock="Top" Style="{StaticResource PanelBackground}">
                <Label Name="lblProductName" Style="{StaticResource ProductNameLabel}">Product Name:</Label>
            </DockPanel>
            <ToggleButton IsChecked="False" DockPanel.Dock="Right" ToolTip="Notes" Name="btnNotes">
                <Image Style="{StaticResource JournalToolbarIcon}"/>
            </ToggleButton>
            <Button DockPanel.Dock="Right" ToolTip="Icon" Name="btnSetIcon">
                <Image Source="{Binding Path=Icon.Image}" Width="24" Height="24"/>
            </Button>
            <TextBox Name="txtProductName" Style="{StaticResource ProductName}" Text="{Binding Path=Name}"/>
        </DockPanel>
        <ToolBar DockPanel.Dock="Bottom" Name="AddEditToolbar" DataContext="{Binding Path=Keys}">
            <Button Name="btnAddKeyCode" ToolTip="Add Key Code" Click="AddKeyCode">
                <Image Style="{StaticResource NewToolbarIcon}"/>
            </Button>
            <Button Name="btnRemoveKeyCode" ToolTip="Remove Key Code" Click="RemoveKeyCode">
                <Image Style="{StaticResource DeleteToolbarIcon}"/>
            </Button>
            <TextBox Text="{Binding Path=Code}" Style="{StaticResource KeyAllocToolBarTextBox}"/>
            <TextBox Text="{Binding Path=AllocatedTo}" Style="{StaticResource KeyAllocToolBarTextBox}"/>
        </ToolBar>
        <StackPanel>
            <ListBox Name="lstProductKeys" MinHeight="200" MaxHeight="400" ItemsSource="{Binding}" DataContext="{Binding Path=Keys}" SelectionMode="Single" IsSynchronizedWithCurrentItem="True" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Label Style="{StaticResource KeyAllocToolBarLabel}" Content="Key: "/>
                            <Label Style="{StaticResource KeyAllocToolBarValue}" Content="{Binding Path=Code}"/>
                            <Label Style="{StaticResource KeyAllocToolBarLabel}" Content="Allocated To: "/>
                            <Label Style="{StaticResource KeyAllocToolBarValue}" Content="{Binding Path=AllocatedTo}"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <DockPanel Name="pnlProductNotes" LastChildFill="True" Visibility="Collapsed">
                <DockPanel DockPanel.Dock="Top" Style="{StaticResource PanelBackground}">
                    <Label Style="{StaticResource ProductNameLabel}" Content="Product Notes"/>
                </DockPanel>
                <TextBox Style="{StaticResource ProductNotesTextBox}" Text="{Binding Path=Notes}"/>
            </DockPanel>
        </StackPanel>
    </DockPanel>
</Window>
